package com.bulk.threadPool;

import java.util.concurrent.CompletableFuture;

/**
 * @author 散装java
 * @date 2022-10-21
 */
public class CompletableFutureTest {
    public static void main(String[] args) {

        CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
            System.out.println("执行1");
            throw new RuntimeException("异常bulk");
        }).thenRun(() -> {
            System.out.println("执行2");
        }).exceptionally(throwable -> {
            System.out.println("catch " + throwable.getCause().getMessage());
            return null;
        });
    }


}
